/**
 * Copyright © 2011 looty - Textoo
 * @link http://www.textoo.org
 * @link http://code.google.com/p/textoo/
 * @author lab9 - Bertrand Larrieu
 * @mail lab9.fr@gmail.com
 * @version 2.0
 */

package org.looty.textoo.render 
{
	import flash.display.*;
	import flash.geom.*;
	import flash.text.*;
	import org.looty.core.textoo.render.glyph.*;
	
		
	public class BitmapLetter extends Bitmap implements ILetter
	{
		private var _position		:Point;
		
		private var _glyph			:GlyphBitmapData;
		
		public function BitmapLetter()
		{
			super();
		}
		
		public function construct(glyph:GlyphBitmapData, color:uint, bounds:Rectangle, smoothing:Boolean = false):void 
		{
			_position = new Point(bounds.x + glyph.offset.x, bounds.y + glyph.offset.y);
			
			_glyph = glyph;
			
			bitmapData = _glyph.getColor(color);
			pixelSnapping = PixelSnapping.ALWAYS;
			smoothing = smoothing;
			
			x = _position.x;
			y = _position.y;
		}
		
		public function get position():Point { return _position; }
		/*
		public function set centeredRotation(value:Number):void
		{
			TODO:
			//var matrix:Matrix = transform.matrix;
		}
		*/
		public function get glyph():GlyphBitmapData 
		{
			return _glyph;
		}
		
	}
	
}